#include <iostream>
#include <vector>
using namespace std;

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int T;
  for (cin >> T; T; T--) {
    int a, b, c;
    vector<int> ans;

    cin >> a >> b;
    c = a ^ b;
    for (int i = 0; i < 30; i++) {
      if (c & (1 << i)) {
        if (a < (1 << i)) {
          break;
        }
        a ^= (1 << i);
        ans.push_back(1 << i);
      }
    }
    if (a == b) {
      cout << ans.size() << "\n";
      for (int x : ans) {
        cout << x << " ";
      }
      cout << "\n";
    } else {
      cout << "-1\n";
    }
  }
  return 0;
}